<title>评论管理</title>


<div class="layui-fluid classManager">
    <div class="layui-row">

        <div class="layui-col-md12">

            <div class="layui-card">
                <div class="layui-card-body">
                    <button class="layui-btn layui-btn-sm" data-type="">
                        待认证
                    </button>
                    <hr>
                    <table class="layui-table" id="evaluateEle" lay-filter="evaluateEle">
                    </table>
                </div>
            </div>
        </div>

    </div>
</div>



<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除评论</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="ban">封禁用户</a>
</script>

<script>
    layui.use(['admin', 'table'], function () {
        var table = layui.table,
            admin = layui.admin;
        var $ = layui.$;

        table.render({
            elem : '#evaluateEle',
            url : './json/evaluate/evaluateList.js',
            id : 'evaluateEle',
            page:'true',
            cols :[[
                {field : 'evaluateType', title : '好评/差评', width : 100, sort : true},
                {field : 'evaluateContent', title : '评论内容'},
                {field : 'evaluateTime', title: '评价时间', width : 170},
                {field : 'evaluateName', title : '评价人', width : 150},
                {field : 'evaluateTo', title: '评价给', width : 150},
                {fixed : 'right', align : 'center', toolbar : '#barDemo', minWidth : 160}
            ]]
        });

        //监听工具条
        table.on('tool(evaluateEle)', function (obj) {
            var data = obj.data;

            if (obj.event === 'ban') {
                layer.prompt({
                    formType: 0,
                    title: '封禁原因',
                    area: ['200px', '40px'] //自定义文本域宽高
                }, function (value, index, elem) {
                    alert(value); //得到value
                    layer.close(index);
                });
            } else if (obj.event === 'del') {
                layer.prompt({
                    formType: 0,
                    title: '删除原因',
                    area: ['200px', '40px'] //自定义文本域宽高
                }, function (value, index, elem) {
                    alert(value); //得到value
                    layer.close(index);
                });
            }

        });


    });
</script>